package com.roger.myHome.log;


import lombok.extern.slf4j.Slf4j;

@Slf4j
public class PrintlnErrorLog {

    /**
     * 异常日志
     */
    public static void printlnErrorLog(String title,Exception e, String solution) {
        log.error("\n-----------------------异常分析 start-----------------------------------\n\t" +
                        "异常标题:{}\n\t" +
                        "文件名:{}\n\t" +
                        "类名:{}\n\t" +
                        "方法名:{}\n\t" +
                        "抛出异常行号:{}\n\t" +
                        "异常栈信息:{}\n\t" +
                        "解决方案: {}\n" +
                        "------------------异常分析 end ---------------------------------------",
                title,
                e.getStackTrace()[0].getFileName(),
                e.getStackTrace()[0].getClassName(),
                e.getStackTrace()[0].getMethodName(),
                e.getStackTrace()[0].getLineNumber(),
                e.getMessage(),
                solution
        );
    }

    public static void main(String[] args) {
        int x  = 0;
        for (int i = 1; i <= 100; i++) {
            x += i;
        }
        System.out.println(x);
    }


}
